<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<style>
		div#outer{
			width: 300px;
			height: 300px;
			border:1px solid red;
			margin:0 auto;
		}
		div#center{
			width: 200px;
			height: 200px;
			border:1px solid red;
			margin:0 auto;
		}
		div#inner{
			width: 100px;
			height: 100px;
			border:1px solid red;
			margin:0 auto;
		}
	</style>
	<script type="text/javascript">
		window.onload=function(){
			//1.获取事件目标
			var outer=document.getElementById('outer');

			//2.绑定事件
			/*outer.addEventListener("click",function(){
				alert("outer");
			});*/
			function say(){
				alert("outer2222----");
			}
			outer.addEventListener("click",say,true);

			/*outer.removeEventListener("click",say);*/

			center.addEventListener("click",function(){
				alert("center");
			},true);
			inner.addEventListener("click",function(){
				alert("inner");
			},true);



			/*outer.onclick=function(event){
				alert(this.id)
			}*/

			/*outer.onclick=function(){
				alert("outer2222----");
			}*/

			/*outer.onclick=null;*/
			/*center.onclick=function(event){
				alert(this.id)
			}
			inner.onclick=function(event){
				alert(this.id)
			}*/
		}



	</script>
</head>
<body>
	<div id="outer">
		<div id="center">
			<div id="inner"></div>
		</div>
	</div>
</body>
</html>






